<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org:">
<head>
    <meta charset="UTF-8">
    <title>邮件</title>
    <script src="js/jquery-3.5.1.min.js"></script>
    <script src="../static/js/jquery-3.5.1.min.js"></script>
</head>

<body>

<div>
    邮件通知
</div>
<div>
    <table>
        <tr>
            <td>发件人：</td>
            <td><input type="text" readonly value="wh508377132@163.com" id="from"></td>
        </tr>
        <tr>
            <td>收件邮箱：</td>
            <td><input type="text" readonly value="1466493896@qq.com"  id="to"></td>
        </tr>
        <td>收件人：</td>
        <td><input type="text"   id="name"></td>
        </tr>
        <tr>
            <td>标题：</td>
            <td><input type="text" id="subject"></td>
        </tr>
        <tr>
            <td>内容：</td>
            <td><textarea id="content"></textarea></td>
        </tr>
        <a onclick="clickMail()" href="javascript:void(0);">提交 </a>
    </table>
</div>
</body>
<script type="text/javascript">
    function clickMail() {
        var data = {
            "from": $("#from").val(),
            "to": $("#to").val(),
            "subject": $("#subject").val(),
            "content":$("#content").val(),
            "name": $("#name").val()
        };
        $.ajax({
            url: "upload",
            type: "POST",
            dataType: "json",
            contentType: 'application/json;charset=utf-8',
            data: JSON.stringify(data),
            success: function (data) {
                if (data.code = 2020) {
                    alert("发送成功");
                }
            }
        });
    }

    $("#DianJi").click(function () {
        alert(111)
        clickMail();
    });
</script>
</html>